//
// Created by sjjmw on 3/24/2022.
//
#include "iostream"
#include "vector"
#include "list"
#include "algorithm"
#include "string"
#include "unordered_map"
int xishu[]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};
char finalc[]={ '1' ,'0' ,'x', '9','8',
               '7', '6', '5' ,'4' ,'3' ,'2'};
void handle(std::vector<int> vec
            ){
    int sum=0;
    for(int i=0;i<17;i++){
        printf("%d",vec[i]);
        sum+=vec[i]*xishu[i];
        sum%=11;
    }
//    if(sum==10){
//        printf("x");
//    }else{
    {
        printf("%c",sum[finalc]);
    }
    printf("\n");
}

int main(){
//    int a,b,c;
std::vector<int> buf(18);
    while(
            1
    ){
        char c;
        for(int i=0;i<6;i++){
            c=getchar();
            if(c!=EOF){
                buf[i]=c-'0';
            }else{
                return 0;
            }
        }
        buf[6]=1;buf[7]=9;
        for(int i=0;i<9;i++){
            c=getchar();
            if(c!=EOF){
                buf[8+i]=c-'0';
            }else{
                return 0;
            }
        }
        handle(buf);
    }
    return 0;
}